home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / dev / lang / Python152_Src.lha / Python152_Source / Amiga_Misc / Docs / amiga_module next >
Text File  |  1998-11-10  |  5KB  |  172 lines

  1.  
  2.  
  3.                                AMIGA MODULE
  4.  
  5.                      Irmen de Jong - irmen@bigfoot.com
  6.                                 28 sep 1998
  7.  
  8.  
  9. This document describes the builtin module `amiga'. This is the Amiga version
  10. of the `posix' module which is used on Unix. You should not directly import
  11. this module! Always use module `os' instead.
  12.  
  13. Functions in `amiga' module are listed below. Items marked (*) are discussed
  14. in more detail below this list:
  15.  
  16.     chdir
  17.     chmod
  18.     chown
  19.     close
  20. (*) crc32    *** NEW ***
  21. (*) dup        (needs bsdsocket.library for actual use)
  22. (*) dup2    (needs bsdsocket.library for actual use)
  23.     fdopen
  24.     fstat
  25. (*) fullpath
  26.     getcwd
  27.     getegid    (requires usergroup.library)
  28.     geteuid    (requires usergroup.library)
  29.     getgid    (requires usergroup.library)
  30.     getpgrp    (requires usergroup.library)
  31. (*) getpid
  32.     getuid    (requires usergroup.library)
  33.     link    (will use usergroup.library if present)
  34.     listdir
  35.     lseek
  36.     lstat
  37. (*) mkdir    (will use usergroup.library if present)
  38.     open
  39.     popen
  40.     putenv
  41.     read
  42.     readlink
  43.     remove
  44.     rename
  45.     rmdir
  46.     setgid    (requires usergroup.library)
  47.     setsid    (requires usergroup.library)
  48.     setuid    (requires usergroup.library)
  49.     stat
  50.     strerror
  51.     symlink
  52.     system
  53.     umask    (requires usergroup.library)
  54.     uname
  55.     unlink
  56.     utime
  57.     write
  58.  
  59.   NOT SUPPORTED ARE:
  60.     execv, execve, _exit, fork, getppid, kill, nice, pipe,
  61.     times, wait, waitpid, and some others...
  62.  
  63.   DATA MEMBERS: (Items marked (*): see below, ABOUT ENVIRONMENT)
  64.     O_XXXXX (arguments to open etc.)
  65. (*) environ
  66.     error
  67. (*) globalvars
  68. (*) shellaliases
  69. (*) shellvars
  70.  
  71.  
  72. For  documentation,  see  docs  on  posix  module.   Items  marked  (*) are
  73. different from the ones in the posix module and are described below.
  74.  
  75. Note   that   some   functions   require   AmiTCP   (bsdsocket.library)  or
  76. usergroup.library.   If  you  don't  have  it,  you'll  get  a  SystemError
  77. exception.   Some  functions  work better with usergroup.library but do not
  78. require it.
  79.  
  80.   crc32
  81.   ~~~~~
  82. Added  for  convenience.   Pass  any string to this builtin function and it
  83. returns  the CRC-32 value of the string.  It has a very fast implementation
  84. in machine code.
  85.  
  86.   dup  &  dup2
  87.   ~~~~~~~~~~~~
  88. Currently  only  socket  filedescriptors  can be dup'ed.  If you want to do
  89. this, you will need bsdsocket.library (AmiTCP).
  90.  
  91.   fullpath
  92.   ~~~~~~~~
  93. New function.  Returns the full pathname of a file/directory (i.e.  expands
  94. assigns).    Implemented  here  but  don't  use  it  directly,  always  use
  95. os.path.fullpath (amigapath imports this function).
  96.  
  97.   getpid
  98.   ~~~~~~
  99. Currently  the  memory  address  of  the process structure (FindTask(0)) is
  100. taken as pid.
  101.  
  102.   mkdir
  103.   ~~~~~
  104. Since Python 1.4, the protection mode can be omitted. It defaults to 0777.
  105.  
  106.  
  107.  
  108. ABOUT FILESYSTEM LINK SUPPORT
  109. -----------------------------
  110.  
  111. (Functions: link, symlink, readlink)
  112.  
  113. You can make hardlinks and softlinks, using link and symlink, respectively.
  114. You  can  read the value of a symbolic (soft) link using readlink.  Keep in
  115. mind  that  the  filesystem  must  support links (2.04+ FFS does) All three
  116. functions are designed for compatibility with their Posix equivalents.
  117.  
  118. NOTE:  because of implementation issues, readlink fails when passing only a
  119. device  name  as argument.  This is not a big problem (devices can never be
  120. links anyway).
  121.  
  122.  
  123.  
  124. ABOUT ENVIRONMENT VARIABLES
  125. ---------------------------
  126.  
  127. I made up an extensive but CGI script compatible (and compatible with other
  128. scripts  that expect a Unix system) environment handling system.  Thanks to
  129. Mike Meyer (mwm@contessa.phone.net) for helping me out on the problems with
  130. the old system.
  131.  
  132.     Environment variable dictionaries
  133.     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  134. os.environ       - contains BOTH GLOBAL (ENV:) AND LOCAL (shell) variables
  135.                    If a variable occurs both as global and as local var,
  136.                    the local value has higher prioriy.
  137. os.globalvars    - contains ONLY GLOBAL (ENV:) variables
  138. os.shellvars     - contains ONLY LOCAL (shell) variables
  139.  
  140. IMPORTANT:   changes  made  to the environment variables in os.environ will
  141. now    also    be    made    in    ENV:.    This   means   the   assignment
  142. os.environ['PAGER']='c:more'  will  now  also  set the environment variable
  143. ENV:PAGER  to "c:more".  This feature was introduced in Python version 1.4.
  144. Note  however  that  an  assignment  to a variable in os.environ that was a
  145. local  shell-var  does  NOT  result  in updating the shell variable:  a new
  146. global  variable  with  the same name will be created.  If this is not what
  147. you  want, check out the `environment' module.  Note well that the above is
  148. not  true  for  os.globalvars  and os.shellvars:  they remain read-only and
  149. changes are not propagated to the environment.
  150.  
  151.     The new function: putenv
  152.     ~~~~~~~~~~~~~~~~~~~~~~~~
  153. Python  1.4  introduced a new function in the posix module:  putenv.  So in
  154. our  case  the  amigamodule now also contains this function.  Portable code
  155. should  use  this function (os.putenv), but Amiga specific code can use the
  156. environment module, mentioned below.
  157.  
  158.     Aliases
  159.     ~~~~~~~
  160. Shell   aliases   can   be   accessed  in  the  os.shellaliases  dictionary
  161. (read-only).
  162.  
  163.  
  164.     The `environment' module
  165.     ~~~~~~~~~~~~~~~~~~~~~~~~
  166. This  module  contains a bunch of environment handling functions.  Read the
  167. document `environment_module' for a description of this module.
  168.  
  169.  
  170.  
  171. SEE ALSO: os module
  172.